home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 321 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: news.crd.ge.com!usenet
  2. From: Christopher R Volpe <volpe@ash.crd.ge.com>
  3. Newsgroups: comp.std.c
  4. Subject: Re: A question about: #define
  5. Date: Mon, 12 Feb 1996 17:27:19 -0500
  6. Organization: GE Corporate Research & Development, Schenectady, NY
  7. Message-ID: <311FBEC7.A84@ash.crd.ge.com>
  8. References: <qug2cgc3xo.fsf@chivas.eua.ericsson.se> <311f3104.236842591@nntp.ix.netcom.com>
  9. NNTP-Posting-Host: bart.crd.ge.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)
  14.  
  15. Mike Rubenstein wrote:
  16. > tobbe@erix.ericsson.se (Torbj|rn T|rnkvist) wrote:
  17. > >
  18. > > I'm wondering if the following preprocessor directive is
  19. > > permissible in ANSI C ?
  20. > >
  21. > >   #define A #define B
  22. > It depends on what you mean.  It's legal to define A like that, but
  23. > using A as a macro in your program is not.  From ISO 6.8.3.4:
  24. >         The resulting [from macro expansion] completely macro-replaced
  25. >         preprocessing token sequence is not processed as a
  26. >         preprocessing directive even if it resembles one.
  27.  
  28.  
  29.  
  30. The fact that the result is not processed as a preprocessing directive
  31. even if it resembles one does not necessarily mean that the use of macro
  32. A above would be illegal. I suspect you pass A as an argument to another
  33. macro that stringizes the expansion of its parameter, or something along
  34. those lines. I haven't really thought about it that much so I'm
  35. guessing.
  36.  
  37.  
  38.  
  39. --
  40.  
  41. Chris Volpe                Phone: (518) 387-7766 (Dial Comm 8*833
  42. GE Corporate R&D            Fax:   (518) 387-6560
  43. PO Box 8, Schenectady, NY 12301        Email: volpecr@crd.ge.com
  44.